package net.ariel.myideablog.model;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable
public class Category {

	@PrimaryKey
	@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private String name;
	
	private String keyString;
	
	public Category() {
		
	}
	
	public Category(String name) {
		this.name = name;
	}
	
	public void setKey(Key key) {
		this.key = key;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Key getKey() {
		return key;
	}
	
	public String getName() {
		return name;
	}
	
	
	public String getKeyString() {
		return KeyFactory.keyToString(key);
	}
	
	@Override
	public String toString() {
		return name;
	}
}
